Line and step line series
A LineSeries joins its points with a line, straight or curved, and can fill the area below it. A StepLineSeries
joins them with horizontal and vertical segments instead. Both series share almost every property, so this article covers
them together: everything below applies to both, except LineSmoothness, which only the line series has.
This article highlights the most used features. Every property is listed in the API explorer: LineSeries and StepLineSeries.
Basic line
Set the Values of the series and add it to the chart. Every point is drawn with a geometry, a circle by default.
The second generic argument changes the geometry, the second series in this sample uses a StarGeometry.

@page "/Lines/Basic"
@using LiveChartsCore.SkiaSharpView.Blazor
@using LiveChartsCore;
@using LiveChartsCore.SkiaSharpView;
@using LiveChartsCore.SkiaSharpView.Drawing.Geometries;
@using LiveChartsCore.SkiaSharpView.Painting;
@using LiveChartsCore.SkiaSharpView.VisualElements;
@using SkiaSharp;
<CartesianChart Series="@series" Title="@title" />
@code {
private ISeries[] series = new ISeries[]
{
new LineSeries<double>
{
Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
Fill = null,
GeometrySize = 20
},
new LineSeries<int, StarGeometry>
{
Values = new int[] { 4, 2, 5, 2, 4, 5, 3 },
Fill = null,
GeometrySize = 20
}
};
private DrawnLabelVisual title = new DrawnLabelVisual(
new LabelGeometry
{
Text = "My chart title",
TextSize = 25,
Padding = new LiveChartsCore.Drawing.Padding(15)
});
}
Straight or smooth lines
LineSmoothness goes from 0 to 1: 0 draws straight segments between the points and 1 draws the most curved
line. Values outside that range are clamped to it. Setting GeometrySize to 0 hides the points.

@page "/Lines/Straight"
@using LiveChartsCore.SkiaSharpView.Blazor
@using LiveChartsCore;
@using LiveChartsCore.SkiaSharpView;
<CartesianChart
Series="@series">
</CartesianChart>
@code {
private ISeries[] series = new ISeries[]
{
new LineSeries<double>
{
Values = new double[] { 5, 0, 5, 0, 5, 0 },
Fill = null,
GeometrySize = 0,
LineSmoothness = 0
},
new LineSeries<double>
{
Values = new double[] { 7, 2, 7, 2, 7, 2 },
Fill = null,
GeometrySize = 0,
LineSmoothness = 1
}
};
}
Area
The Fill paint fills the area under the line. Set Fill to null to draw only the line, or set Stroke and the
geometry paints to null to draw only the area.

@page "/Lines/Area"
@using LiveChartsCore.SkiaSharpView.Blazor
@using LiveChartsCore;
@using LiveChartsCore.SkiaSharpView;
@using LiveChartsCore.SkiaSharpView.Painting;
@using SkiaSharp;
<CartesianChart
Series="@series"
DrawMarginFrame="@drawMarginFrame">
</CartesianChart>
@code {
private ISeries[] series = new ISeries[]
{
new LineSeries<double>
{
Values = new double[] { -2, -1, 3, 5, 3, 4, 6 },
Fill = new SolidColorPaint(SKColor.Parse("#6495ED")),
Stroke = null,
GeometryFill = null,
GeometryStroke = null
}
};
private DrawMarginFrame drawMarginFrame = new DrawMarginFrame
{
Stroke = new SolidColorPaint(SKColor.Parse("#64b4b4b4")),
Fill = new SolidColorPaint(SKColor.Parse("#32dcdcdc"))
};
}
Stroke and fill paints
When Stroke, Fill, GeometryStroke or GeometryFill are not set, LiveCharts picks them from the current theme,
based on the position of the series in the chart's series collection. Set them to use your own colors.
Stroke draws the line:

Series = new ISeries[]
{
new LineSeries<int>
{
Values = new [] { 4, 4, 7, 2, 8 },
Stroke = new SolidColorPaint(SKColors.Blue) { StrokeThickness = 4 }, // mark
Fill = null,
GeometryFill = null,
GeometryStroke = null
},
new LineSeries<int>
{
Values = new [] { 7, 5, 3, 2, 6 },
Stroke = new SolidColorPaint(SKColors.Red) { StrokeThickness = 8 }, // mark
Fill = null,
GeometryFill = null,
GeometryStroke = null
},
new LineSeries<int>
{
Values = new [] { 4, 2, 5, 3, 9 },
Stroke = new SolidColorPaint(SKColors.Green) { StrokeThickness = 1 }, // mark
Fill = null,
GeometryFill = null,
GeometryStroke = null
}
};
Fill draws the area. The alpha channel goes from 0 (transparent) to 255 (opaque):

Series = new ISeries[]
{
new LineSeries<int>
{
Values = new [] { 4, 4, 7, 2, 8 },
Fill = new SolidColorPaint(SKColors.Blue.WithAlpha(90)), // mark
Stroke = null,
GeometryFill = null,
GeometryStroke = null
},
new LineSeries<int>
{
Values = new [] { 7, 5, 3, 2, 6 },
Fill = new SolidColorPaint(SKColors.Red.WithAlpha(90)), // mark
Stroke = null,
GeometryFill = null,
GeometryStroke = null
},
new LineSeries<int>
{
Values = new [] { 4, 2, 5, 3, 9 },
Fill = new SolidColorPaint(SKColors.Green.WithAlpha(90)), // mark
Stroke = null,
GeometryFill = null,
GeometryStroke = null
}
};
Paints can also draw gradients and dashed lines, see the Paints article.
Point geometries
GeometryFill and GeometryStroke paint the shape drawn at each point, and GeometrySize sets its size. While
GeometryStroke is not set, the theme derives it from the series' Stroke (when Stroke is a SolidColorPaint),
so the points match the line.

Series = new ISeries[]
{
new LineSeries<int>
{
Values = new [] { 4, 4, 7, 2, 8 },
Stroke = new SolidColorPaint(SKColors.Blue) { StrokeThickness = 4 },
Fill = null,
GeometryFill = new SolidColorPaint(SKColors.AliceBlue), // mark
GeometryStroke = new SolidColorPaint(SKColors.Gray) { StrokeThickness = 4 } // mark
},
new LineSeries<int>
{
Values = new [] { 7, 5, 3, 2, 6 },
Stroke = new SolidColorPaint(SKColors.Red) { StrokeThickness = 8 },
Fill = null,
GeometryFill = new SolidColorPaint(SKColors.IndianRed), // mark
GeometryStroke = new SolidColorPaint(SKColors.DarkSalmon) { StrokeThickness = 8 } // mark
}
};
The shape itself can be any geometry. The next sample uses, in order, the default circle, a predefined
StarGeometry (the LiveChartsCore.SkiaSharpView.Drawing.Geometries namespace has more, such as CrossGeometry,
DiamondGeometry and RectangleGeometry), an SVG path through VariableSVGPathGeometry and GeometrySvg, and a
geometry drawn with the SkiaSharp API (MyGeometry).

@page "/Lines/Custom"
@using LiveChartsCore.SkiaSharpView.Blazor
@using LiveChartsCore;
@using LiveChartsCore.SkiaSharpView;
@using LiveChartsCore.SkiaSharpView.Drawing.Geometries;
@using LiveChartsCore.SkiaSharpView.Painting;
@using SkiaSharp;
@using LiveChartsCore.Drawing;
@using ViewModelsSamples.Lines.Custom
<CartesianChart
Series="@series">
</CartesianChart>
@code {
private ISeries[] series = new ISeries[]
{
new LineSeries<double>
{
Values = new double[] { 2, 1, 4, 2, 2, -5, -2 },
Fill = null,
GeometrySize = 20
},
new LineSeries<double, StarGeometry>
{
Values = new double[] { 3, 3, -3, -2, -4, -3, -1 },
Fill = null,
GeometrySize = 20
},
new LineSeries<double, VariableSVGPathGeometry>
{
Values = new double[] { -2, 2, 1, 3, -1, 4, 3 },
Fill = null,
GeometrySize = 20,
GeometrySvg = SVGPoints.Pin
},
new LineSeries<double, MyGeometry>
{
Values = new double[] { 4, 5, 2, 4, 3, 2, 1 },
Fill = null,
GeometrySize = 20
}
};
}
using LiveChartsCore.Drawing;
using LiveChartsCore.SkiaSharpView.Drawing;
namespace ViewModelsSamples.Lines.Custom;
public class MyGeometry : BoundedDrawnGeometry, IDrawnElement<SkiaSharpDrawingContext>
{
public void Draw(SkiaSharpDrawingContext context)
{
var paint = context.ActiveSkiaPaint;
var canvas = context.Canvas;
canvas.DrawRect(X, Y, Width, Height, paint);
canvas.DrawLine(X, Y, X + Width, Y + Height, paint);
canvas.DrawLine(X + Width, Y, X, Y + Height, paint);
}
}
Customize each point
The PointMeasured event (a command in the XAML samples) runs every time a point gets its size and position, and
gives access to both the data and the drawn shape. This sample stores a wind direction in each data point and rotates
an arrow geometry to match it.

@page "/Lines/CustomPoints"
@using LiveChartsCore.SkiaSharpView.Blazor
@using LiveChartsCore;
@using LiveChartsCore.SkiaSharpView;
@using LiveChartsCore.SkiaSharpView.Drawing.Geometries;
@using SkiaSharp;
<CartesianChart
Series="@series">
</CartesianChart>
@code {
public class DataPoint
{
public int Value { get; set; }
public float Rotation { get; set; }
}
public class ArrowGeometry : BaseSVGPathGeometry
{
private static SKPath _path = SKPath.ParseSvgPathData(
"M1 16 A15 15 0 1 0 31 16 A15 15 0 1 0 1 16 Z " + // the circle
"M16 25 L16 7 M9.5 13.5 L16 7 L22.5 13.5"); // the arrow, pointing up
public ArrowGeometry() : base(_path) { }
}
public class CustomArrowLineSeries : LineSeries<DataPoint, ArrowGeometry>
{
public CustomArrowLineSeries()
{
LiveCharts.Configure(config =>
config.HasMap<DataPoint>((dataPoint, index) => new(index, dataPoint.Value)));
Fill = null;
GeometrySize = 34;
PointMeasured += (point) =>
{
var dataPoint = (DataPoint)point.Context.DataSource!;
point.Context.Visual!.RotateTransform = dataPoint.Rotation;
};
}
}
private ISeries[] series = new ISeries[]
{
new CustomArrowLineSeries
{
Values = new DataPoint[]
{
new DataPoint { Value = 4, Rotation = 0 },
new DataPoint { Value = 6, Rotation = 20 },
new DataPoint { Value = 8, Rotation = 90 },
new DataPoint { Value = 2, Rotation = 176 },
new DataPoint { Value = 7, Rotation = 55 },
new DataPoint { Value = 9, Rotation = 226 },
new DataPoint { Value = 3, Rotation = 320 }
}
}
};
}
Gaps
A null value creates a gap in the line, both a null number (double?, int?) and a null item in the
collection, such as a null ObservablePoint. This is controlled by EnableNullSplitting, which is true by
default; disabling it saves some work when your data never contains nulls.

@page "/General/NullPoints"
@using LiveChartsCore.SkiaSharpView.Blazor
@using LiveChartsCore;
@using LiveChartsCore.Defaults;
@using LiveChartsCore.SkiaSharpView;
<CartesianChart
Series="@series">
</CartesianChart>
@code {
private static double?[] values1 = new double?[] { 5, 4, null, 3, 2, 6, 5, 6, 2 };
private static double?[] values2 = new double?[] { 2, 6, 5, 3, null, 5, 2, 4, null };
private static ObservablePoint?[] values3 = new ObservablePoint?[]
{
new ObservablePoint { X = 0, Y = 1 },
new ObservablePoint { X = 1, Y = 4 },
null,
new ObservablePoint { X = 4, Y = 5 },
new ObservablePoint { X = 6, Y = 1 },
new ObservablePoint { X = 8, Y = 6 }
};
private ISeries[] series = new ISeries[]
{
new LineSeries<double?> { Values = values1 },
new LineSeries<double?> { Values = values2 },
new LineSeries<ObservablePoint?> { Values = values3 }
};
}
Step lines
A StepLineSeries takes the same properties as the line series, except LineSmoothness. All the paints, geometries,
gaps and data labels in this article work the same way on it.

@page "/StepLines/Basic"
@using LiveChartsCore.SkiaSharpView.Blazor
@using LiveChartsCore.SkiaSharpView
@using LiveChartsCore
@using LiveChartsCore.SkiaSharpView.Painting
@using LiveChartsCore.SkiaSharpView.VisualElements
@using LiveChartsCore.SkiaSharpView.Drawing.Geometries
@using SkiaSharp
<CartesianChart
Series="Series"
Title="Title">
</CartesianChart>
@code {
private ISeries[] Series { get; set; }
private DrawnLabelVisual Title { get; set; }
protected override void OnInitialized()
{
var values = new double[] { 2, 1, 3, 4, 3, 4, 6 };
Series = new ISeries[]
{
new StepLineSeries<double>
{
Values = values,
Fill = null,
GeometrySize = 20
}
};
Title = new DrawnLabelVisual(
new LabelGeometry
{
Text = "My chart title",
TextSize = 25,
Padding = new LiveChartsCore.Drawing.Padding(15)
});
}
}
Data labels
Data labels draw a label next to every point:

new LineSeries<double>
{
Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
Fill = null,
DataLabelsSize = 20,
DataLabelsPaint = new SolidColorPaint(SKColors.Blue),
// all the positions:
// https://livecharts.dev/api/2.2.0/LiveChartsCore.Measure.DataLabelsPosition
DataLabelsPosition = LiveChartsCore.Measure.DataLabelsPosition.Top,
// the formatter takes the point and returns the label text
DataLabelsFormatter = point => point.Coordinate.PrimaryValue.ToString("C2")
}
Data padding
DataPadding is the space between the first and last points and the edges of the chart, measured in axis ticks
(the distance between two separators). It is a LvcPoint, X for the horizontal edges and Y for the vertical ones.

new LineSeries<double>
{
Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
DataPadding = new LvcPoint(0, 0), // mark
GeometryStroke = null,
GeometryFill = null,
Fill = null
}
Data, names and updates
Valuestakes anyIEnumerable<T>. Use anObservableCollection<T>and the chart animates every added, removed or replaced value, see automatic updates.- To plot your own types, or set both X and Y, see mappers.
Nameis shown in tooltips and legends. When it is not set, the tooltip shows the values without a series name.ZIndexsets which series draws on top, andIsVisibleshows or hides the series.